import { RouteRecordRaw, RouterView } from 'vue-router'
import Layout from '@/layout/index.vue'

const systemRouter: RouteRecordRaw[] = [
  {
    path: '/system',
    component: Layout,
    redirect: '/system/identity',
    meta: {
      title: '系统',
      icon: 'Setting',
    },
    children: [
      {
        path: 'identity',
        name: 'Identity',
        redirect: '/system/identity/role',
        component: RouterView,
        meta: {
          title: '身份标识管理',
          icon: 'UserFilled',
        },
        children: [
          {
            path: 'role',
            name: 'Role',
            component: () => import('@/views/system/identity/role/index.vue'),
            meta: {
              title: '角色管理',
              icon: 'lock',
              policy: 'AbpIdentity.Roles',
            },
          },
          {
            path: 'user',
            name: 'User',
            component: () => import('@/views/system/identity/user/index.vue'),
            meta: {
              title: '用户管理',
              icon: 'user',
              policy: 'AbpIdentity.Users',
            },
          },
          {
            path: 'department',
            name: 'Department',
            component: () =>
              import('@/views/system/identity/department/index.vue'),
            meta: {
              title: '组织结构',
              icon: 'school',
            },
          },
          {
            path: 'claim-types',
            name: 'ClaimTypes',
            component: () =>
              import('@/views/system/identity/claimTypes/index.vue'),
            meta: {
              title: '声明类型',
              icon: 'ShoppingCart',
            },
          },
          {
            path: 'security-logs',
            name: 'SecurityLog',
            component: () =>
              import('@/views/system/identity/securityLog/index.vue'),
            meta: {
              title: '安全日志',
              icon: 'Paperclip',
            },
          },
          {
            path: 'entity-logs',
            name: 'EntityLogs',
            component: () =>
              import('@/views/system/identity/entityLog/index.vue'),
            meta: {
              title: '实体变更',
              icon: 'SetUp',
            },
          },
        ],
      },
      {
        path: 'identity-server',
        name: 'IdentityServer',
        redirect: '/system/identity-server/clients',
        component: RouterView,
        meta: {
          title: 'Identity Server',
          icon: 'Promotion',
        },
        children: [
          {
            path: 'clients',
            name: 'Clients',
            component: () =>
              import('@/views/system/identityServer/client/index.vue'),
            meta: {
              title: '客户端',
              icon: 'Monitor',
            },
          },
          {
            path: 'identity-resources',
            name: 'IdentityResources',
            component: () =>
              import(
                '@/views/system/identityServer/identityResources/index.vue'
              ),
            meta: {
              title: 'Identity资源',
              icon: 'Suitcase',
            },
          },
          {
            path: 'api-resources',
            name: 'ApiResources',
            component: () =>
              import('@/views/system/identityServer/apiResources/index.vue'),
            meta: {
              title: 'Api资源',
              icon: 'Box',
            },
          },
          {
            path: 'api-scopes',
            name: 'ApiScopes',
            component: () =>
              import('@/views/system/identityServer/apiScopes/index.vue'),
            meta: {
              title: 'Api Scopes',
              icon: 'FirstAidKit',
            },
          },
        ],
      },
      {
        path: 'audit-logs',
        name: 'AuditLogs',
        component: () => import('@/views/system/auditLog/index.vue'),
        meta: {
          title: '审计日志',
          icon: 'list',
        },
      },
      {
        path: 'rules',
        name: 'Rules',
        component: () => import('@/views/system/rules/index.vue'),
        meta: {
          title: '系统配置',
          icon: 'Tools',
        },
      },
    ],
  },
]

export default systemRouter
